home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / CUTILV1.LZH / SWITCH1.C < prev    next >
Text File  |  1983-12-29  |  3KB  |  88 lines

  1. /******************************************************************************
  2. *******************************************************************************
  3.  
  4.  
  5.              THIS UTILITY SELECTS THE ACTIVE DISPLAY
  6.          USAGE:  switch [MONITOR] [MODE]
  7.  
  8.              [MONITOR] = monochrome or color.
  9.             type in either mono or monochrome,
  10.                 or col or color for color display.
  11.               *****MUST BE IN LOWER CASE*****
  12.  
  13.              [MODE] = (FOR COLOR ONLY)
  14.             0     40 * 25 BLACK AND WHITE
  15.             1     40 * 25 COLOR
  16.             2     80 * 25 BLACK AND WHITE
  17.             3     80 * 25 COLOR
  18.             4     320 * 200 COLOR  (MED. RES.)
  19.             5     320 * 200 BLACK AND WHITE  (MED. RES.)
  20.             6     640 * 200 BLACK AND WHITE  (HIGH RES.)
  21.  
  22. *******************************************************************************
  23. ****          THIS PROGRAM BROUGHT TO YOU BY THE               ****
  24. ****              THE UNHOLY PIRATE                   ****
  25. *******************************************************************************
  26.  
  27.  
  28.  
  29.  
  30.  
  31. *******************************************************************************
  32. ******************************************************************************/
  33.  
  34.  
  35. #include "stdio.h"
  36. #include "conio.h"
  37. #include "utility.h"
  38. #include "screen.h"
  39. #include "string.h"
  40. main(argc, argv)
  41. int argc;
  42. char **argv;
  43. {
  44.     ADS equip_flag, new_equip_flag;
  45.     int comlinptr, ax, bx, cx, dx, mode, columns, page;
  46.     unsigned flag;
  47.  
  48.     if(argc < 2)/*check for command line argument*/
  49.         utabort("NO COMMAND LINE ARGUMENT  switch [MONITOR] [MODE]");
  50.  
  51.     equip_flag.s = 0x0040;/*rom bios data segment*/
  52.     equip_flag.r = 0x0010;/*offset*/
  53.     new_equip_flag.s = _defds;/*default data segment*/
  54.     new_equip_flag.r = &flag;
  55.  
  56.  
  57.     if((stsindex("mono", argv[1])) == 0){/*switch to monochrome*/
  58.         if(!scmode(&mode, &columns, &page))/*check not on monochrome*/
  59.             utabort("ALREADY ON MONOCHROME ADAPTER");
  60.         bios(17, &ax, &bx, &cx, &dx);/*get current flag into ax*/
  61.         flag = ax | 0x0030;/*set equipment flag to monochrome*/
  62.         utslmove(&new_equip_flag, &equip_flag, 4);/*return flag*/
  63.         screset(0);/*bios set mode call*/
  64.         exit();
  65.     }
  66.  
  67.     if((stsindex("col", argv[1])) == 0){/*switch to color display*/
  68.          if(argc != 3 || argc > 3)/*correct number of arguments?*/
  69.         utabort("NO COMMAND LINE ARGUMENT  switch [MONITOR] [MODE]");
  70.          if(scmode(&mode, &columns, &page))/*check not on color already*/
  71.               utabort("ALREADY ON COLOR ADAPTER");
  72.          utslmove(&equip_flag, &new_equip_flag, 4);
  73.          flag = flag ^ 0x0030;/*erase old display info*/
  74.          flag = flag | 0x0020;/*set as 80 * 25 color card*/
  75.          utslmove(&new_equip_flag, &equip_flag, 4);/*return flag*/
  76.          stcd_i(argv[2], &comlinptr);/*set com line arg to integer*/
  77.          screset(comlinptr);/*set mode from command line*/
  78.          exit();
  79.     }
  80.     utabort("NO COMMAND LINE ARGUMENT  switch [MONITOR] [MODE]");
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.